package second.array;

public class Solution03 {
    public int removeElement(int[] nums, int val) {
        int i = 0;
        int j = 0;
        while (i < nums.length && j < nums.length) {
            if (nums[i] != val) nums[j++] = nums[i++];
            else i++;
        }
        return j;
    }
}
